
<template>
  <!-- 申请 -->
  <div class="Application">
    <div class="nav">
      <p>
        <span class="nav_left">本月申请情况</span>
      </p>
      <p>
        <span>
          <em>{{alldata.WZ}}</em>
        </span>
        <i>物资</i>
      </p>

      <p>
        <span>
          <em>{{alldata.WX}}</em>
        </span>
        <i>维修</i>
      </p>
      <p>
        <span>
          <em>{{alldata.YC}}</em>
        </span>
        <i>用车</i>
      </p>
      <p>
        <span>
          <em>{{alldata.JD}}</em>
        </span>
        <i>接待</i>
      </p>
      <!-- <p class="nav_right">
        <span>
          <em>{{jiekuan}}</em>
        </span>
        <i>借款</i>
      </p>-->
    </div>
    <div class="check" @click="ApplicationForm">申请</div>
    <div class="body">
      <el-table :data="tableData" style="width:100%" height="620" stripe show-overflow-tooltip>
        <el-table-column prop="createOnStr" label="申请日期" align="center"></el-table-column>
        <el-table-column prop="typeStr" label="类型" align="center"></el-table-column>
        <el-table-column prop="stateStr" label="状态" align="center"></el-table-column>
        <el-table-column prop="creater" label="申请人" align="center"></el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-button
              type="warning"
              size="mini"
              @click="ApplicationDetail(scope.row.id,scope.row.type,0)"
              v-if="scope.row.paixu==1"
            >审核</el-button>
            <el-button
              type="primary"
              size="mini"
              @click="ApplicationDetail(scope.row.id,scope.row.type,1)"
            >详情</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <template>
      <el-pagination
        background
        layout="prev, pager, next"
        :total="total"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
      ></el-pagination>
    </template>
  </div>
</template>

<script>
import axios from "axios";
export default {
  components: {},
  computed: {
    // autoHeightTable () {
    //   return document.documentElement.scrollHeight - 251 -78
    // }
  },
  data () {
    return {
      total: 0,
      current: 1,
      pagesize: 10,
      tableData: [],
      creater: 0,
      key: 0,
      alldata: {}
    };
  },
  created () {
    this.creater = JSON.parse(localStorage.getItem("message")).Id;
    this.getData(0);
    this.gettotal()
  },
  methods: {
    // 首页列表数据
    getData (page) {
      var obj = { pn: page, PerPageSize: this.pagesize, key: this.key, creater: this.creater };
      var objs = JSON.stringify(obj);
      let the = { index: 17, jsondata: objs }
      // console.log(objs);
      axios.post("/apis/MyCenter.asmx/GetData", the).then(({ data }) => {
        var list = JSON.parse(data.d);
        // console.log(list);
        this.total = list.count;
        this.tableData = list.data;
      });
    },
    // 首页统计数据
    gettotal () {
      var obj = { creater: this.creater };
      var objs = JSON.stringify(obj);
      let the = { index: 18, jsondata: objs }
      axios.post("/apis/MyCenter.asmx/GetData", the).then(({ data }) => {
        var list = JSON.parse(data.d);
        this.alldata = list;
      });
    },
    // 详情
    ApplicationDetail (e, type, shows) {
      this.$router.push({
        path: "./ApplicationDetail",
        query: { e: e, type: type, shows: shows }
      });
    },
    ApplicationForm () {
      this.$router.push("./ApplicationForm");
    },
    // 分页
    handleCurrentChange (e) {
      this.getData(e - 1);
    }
  }
};
</script>

<style lang="scss" scoped>
@import '@/assets/scss/base.scss';
.nav {
  // border: solid 1px red;
  height: 100px;
  text-align: center;
  display: flex;
  position: relative;
  background-color: $white;
  height: 100px;
  width: 62%;
  margin-left: 15px;
  margin-top: 10px;
  font-weight: bold;

  p {
    height: 80px;
    width: 25%;
    margin: 10px 1%;
    background: $white;
    border-radius: 5px;
    color: $Personnel;
    border-right: solid 1px #ccc;
    span {
      display: block;
      margin-top: 10px;
      font-size: 18px;
      em {
        font-weight: bold;
        font-size: 28px;
      }
    }
    i {
      color: #333;
      font-style: normal;
    }
  }
}
.nav .nav_left {
  margin-top: 30px;
}
.nav .nav_right {
  border: none;
}
.check {
  height: 95px;
  width: 110px;
  margin-left: 90%;
  margin-top: -95px;
  line-height: 100px;
  border-radius: 5px;
  color: $Personnel;
  font-weight: bold;
  border: solid 1px $Personnel;
  cursor: pointer;
  text-align: center;
  background-color: #e9eefa;

  font-size: 18px;
}
.body {
  width: 98%;

  background-color: $white;
  margin-left: 15px;
  margin-top: 10px;
}
.el-pagination {
  margin-top: 25px;
  text-align: center;
}
</style>
<style >
/* .el-table td, .el-table th{
  padding: 6px 0;
} */
</style>